import { ProfileDetail, ProfileParams } from "@/types/member";
import { httpRequest, httpUpload } from "@/utils/http";

// 获取个人信息
export const getMemberProfileAPI = () => {
    return httpRequest<ProfileDetail>({
        method: 'GET',
        url: '/member/profile',
    });
};

// 上传头像
export const uploadAvatar = (filePath: string) => {
    return httpUpload<string>({
        url: '/member/profile/avatar',
        name: 'file',
        filePath,
    });
};

// 修改个人信息
export const putMemberProfileAPI = (data: ProfileParams) => {
    return httpRequest<ProfileDetail>({
        method: 'PUT',
        url: '/member/profile',
        data,
    });
};